package com.example.sulei.rootchangerinfo.hook;


import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.telephony.TelephonyManager;
import android.util.Log;

import com.example.sulei.rootchangerinfo.utils.Contans;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

/**
 * 修改Mac的模块
 * Created by Sulei on 2017/4/14.
 */

public class MacHook extends BaseHook {
    @Override
    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
        //获得Sharedpreference保存的数据
        XSharedPreferences pre = new XSharedPreferences(Contans.PACKAGE_NAME, "prefs");
        hookMethod(WifiInfo.class, "getMacAddress", pre.getString("mac", null));
        Log.d("pre", "handleLoadPackage() returned mac: " + pre.getString("mac", null));
        Log.d("pre", "this.getClass().getPackage().getName(): " + this.getClass().getPackage().getName());
    }

}
